package org.zzk.dao;

import com.google.gson.JsonObject;
import lombok.Data;

@Data
public class MatchResult {
    private final boolean matched;
    private final String roomId;
    private final Player opponent;

    // 私有构造方法
    private MatchResult(boolean matched, String roomId, Player opponent) {
        this.matched = matched;
        this.roomId = roomId;
        this.opponent = opponent;
    }

    // 静态工厂方法
    public static MatchResult success(String roomId, Player opponent) {
        return new MatchResult(true, roomId, opponent);
    }

    public static MatchResult waiting() {
        return new MatchResult(false, null, null);
    }

    public JsonObject getOpponentInfo() {
        return opponent.getPlayerInfo();
    }
}
